# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=cansina
pkgver=65.ee7806a
pkgrel=4
epoch=2
groups=('blackarch' 'blackarch-webapp' 'blackarch-scanner')
pkgdesc='A python-based Web Content Discovery Tool.'
arch=('any')
url='https://github.com/deibit/cansina'
license=('GPL3')
depends=('python' 'python-requests' 'java-environment')
makedepends=('git')
source=("git+https://github.com/deibit/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/$pkgname/" *.py

  for i in core plugins utils ; do
    install -dm 755 "$i" "$pkgdir/usr/share/$pkgname/$i"
    cp -a --no-preserve=ownership "$i"/* "$pkgdir/usr/share/$pkgname/$i"
  done

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python ./$pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

